package com.jrx.anytxn.reporting.job.loanAcct.step;

import com.jrx.anytxn.reporting.bean.ReportingDataBean;
import com.jrx.anytxn.reporting.service.IReportingDataDealService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.batch.item.ItemWriter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AutoAssemReportingWriter implements ItemWriter<ReportingDataBean> {
    @Autowired
    private IReportingDataDealService reportingDataDealService;

    @Override
    public void write(List<? extends ReportingDataBean> items) throws Exception {
        if(CollectionUtils.isNotEmpty(items)){
            for(ReportingDataBean reportingDataBean :items) {
                reportingDataDealService.saveReportingDate(reportingDataBean);
            }
        }
    }
}
